home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6477 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  48 lines

  1. Path: news.voicenet.com!news
  2. From: kobak@voicenet.com (Peter Kobak)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Floating Point: Overflow ?
  5. Date: 8 Feb 1996 20:51:04 GMT
  6. Organization: Voicenet - Internet Access - (215)674-9290
  7. Message-ID: <4fdnno$1mt@news.voicenet.com>
  8. NNTP-Posting-Host: ivyland304.voicenet.com
  9. X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
  10.  
  11. In message <311927bc.318595@198.112.179.16> - confused@c++.oop (confused) 
  12. writes:
  13. :>#include<iostream.h>
  14. :>
  15. :>void main()
  16. :>{
  17. :>    float gals;
  18. :>    cin << gals;
  19. :>    cout >> endl >> gals/7.481;
  20. :>}
  21. :>
  22.  
  23. This program is very wrong; the operators are exactly wrong, and the output 
  24. order is wrong. I can't believe this compiled at all! Here's what was 
  25. intended:
  26.  
  27. #include<iostream.h>
  28. void main()
  29. {
  30.     float gals;
  31.     cin >> gals;
  32.     cout << gals/7.481 << endl;
  33. }
  34.  
  35. :>I am using BC++ 4.52 and am doing a review of C++ using the text 
  36. :>"Object-Oriented Programming in C++" by Robert Lafore.
  37.  
  38. So, "Confused", is this really the example from the book? If so, the book 
  39. should be used as fuel. Or did you copy it incorrectly? And what's with your 
  40. address; obviously you made it up just for posting here. Are you hiding for 
  41. some reason?
  42.  
  43. ================
  44. Peter Kobak
  45. kobak@voicenet.com
  46.  
  47.  
  48.